package com.example.charlotte.snakegame;

import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.view.View;

public class GameActivity extends BaseActivity {
    public static GameActivity instance = null;
    @Override
    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
                    | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
            //View.SYSTEM_UI_FLAG_HIDE_NAVIGATION :隐藏虚拟导航按键
            //View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY：黏性全屏沉浸模式
            //顶部下滑会显示出透明的状态栏和虚拟导航栏，在一段时间以后自动恢复成全屏沉浸模式
        }
        setContentView(new SnakeView(this));
        stopService(new Intent(GameActivity.this, BGMService.class));
        instance=this;


    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        SnakeView.music.recycle();

    }

    @Override
    protected void onPause() {
        super.onPause();
        SnakeView.music.pauseGameMusic();

    }

    @Override
    protected void onResume() {
        super.onResume();
        SnakeView.music.startMusic(0);
    }


}

